Option Strict Off
Option Explicit On
Friend Class frmChild
	Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'For the start-up form, the first instance created is the default instance.
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'This call is required by the Windows Form Designer.
		InitializeComponent()
		'This form is an MDI child.
		'This code simulates the VB6 
		' functionality of automatically
		' loading and showing an MDI
		' child's parent.
		Me.MDIParent = Schedule.frmMDI.DefInstance.DefInstance
		Schedule.frmMDI.DefInstance.DefInstance.Show
		'The MDI form in the VB6 project had its
		'AutoShowChildren property set to True
		'To simulate the VB6 behavior, we need to
		'automatically Show the form whenever it
		'is loaded.  If you do not want this behavior
		'then delete the following line of code
		'UPGRADE_NOTE: Remove the next line of code to stop form from automatically showing. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2018"'
		Me.Show
	End Sub
	'Form overrides dispose to clean up the component list.
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents Schedule1 As AxScheduler.AxSchedule
	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.
	'Do not modify it using the code editor.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmChild))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me.Schedule1 = New AxScheduler.AxSchedule
		CType(Me.Schedule1, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.ClientSize = New System.Drawing.Size(394, 291)
		Me.Location = New System.Drawing.Point(4, 22)
		Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds
		Me.Tag = "R"
		Me.Font = New System.Drawing.Font("Arial", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.BackColor = System.Drawing.SystemColors.Control
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.MaximizeBox = True
		Me.MinimizeBox = True
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.ShowInTaskbar = True
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "frmChild"
		Schedule1.OcxState = CType(resources.GetObject("Schedule1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.Schedule1.Size = New System.Drawing.Size(361, 241)
		Me.Schedule1.Location = New System.Drawing.Point(8, 8)
		Me.Schedule1.TabIndex = 0
		Me.Schedule1.Name = "Schedule1"
		Me.Controls.Add(Schedule1)
		CType(Me.Schedule1, System.ComponentModel.ISupportInitialize).EndInit()
	End Sub
#End Region 
#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As frmChild
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmChild
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmChild()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	
	Const cNewCaption As String = "<New Schedule>"
	
	Dim m_UseCustomDialog As Boolean
	Dim m_Filename As String
	Public Property Filename() As String
		Get
			Filename = m_Filename
		End Get
		Set(ByVal Value As String)
			m_Filename = Value
			Me.Text = Value
		End Set
	End Property
	Public Property UseCustomDialog() As Boolean
		Get
			UseCustomDialog = m_UseCustomDialog
		End Get
		Set(ByVal Value As Boolean)
			m_UseCustomDialog = Value
		End Set
	End Property
    Private Sub frmChild_Activated(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Activated
        frmMDI.DefInstance.CurForm = Me
    End Sub
    Private Sub frmChild_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Me.Text = cNewCaption
    End Sub
    Private Sub frmChild_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize

        On Error Resume Next
        Call Schedule1.SetBounds(0, 0, Me.ClientRectangle.Width, Me.ClientRectangle.Height)

    End Sub
    Private Sub Schedule1_AfterAdd(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_AfterAddEvent) Handles Schedule1.AfterAdd

        'If the "AllowAddDialog" is set to false then
        'the BeforeEdit/AfterEdit events will NOT fire
        'So if you want display a custom edit dialog you
        'must do it in the "AfterAdd" event. This event
        'is called after the appointment has been added
        'to the ScheduleItems collection so it can be
        'accessed with the "NewIndex" parameter

        Call frmMDI.DefInstance.DisplayMessage("AfterAdd", True)

    End Sub
    Private Sub Schedule1_AfterDelete(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_AfterDeleteEvent) Handles Schedule1.AfterDelete
        Call frmMDI.DefInstance.DisplayMessage("AfterDelete", True)
    End Sub
    Private Sub Schedule1_AfterEdit(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_AfterEditEvent) Handles Schedule1.AfterEdit
        Call frmMDI.DefInstance.DisplayMessage("AfterEdit", True)
    End Sub
    Private Sub Schedule1_AfterItemResize(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_AfterItemResizeEvent) Handles Schedule1.AfterItemResize
        Call frmMDI.DefInstance.DisplayMessage("AfterItemResize", True)
    End Sub
    Private Sub Schedule1_AfterMove(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_AfterMoveEvent) Handles Schedule1.AfterMove
        Call frmMDI.DefInstance.DisplayMessage("AfterMove", True)
    End Sub
    Private Sub Schedule1_BackGroundClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BackgroundClickEvent) Handles Schedule1.BackgroundClick
        Call frmMDI.DefInstance.DisplayMessage("BackGroundClick", True)
    End Sub
    Private Sub Schedule1_BeforeAdd(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeAddEvent) Handles Schedule1.BeforeAdd

        'If you do not want an Edit dialogbox upon an Add
        'Then set the property "AllowAddDialog" to False
        'When the user adds an appointment it will be displayed
        'empty and no dialogs will be displayed at all
        'If you still want a custom dialog to be displayed
        'Then you can display it in the "AfterAdd" event

        Call frmMDI.DefInstance.DisplayMessage("BeforeAdd", True)

    End Sub
    Private Sub Schedule1_BeforeColumnResize(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeColumnResizeEvent) Handles Schedule1.BeforeColumnResize
        Call frmMDI.DefInstance.DisplayMessage("BeforeColumnResize", True)
    End Sub
    Private Sub Schedule1_BeforeCopy(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeCopyEvent) Handles Schedule1.BeforeCopy
        Call frmMDI.DefInstance.DisplayMessage("BeforeCopy", True)
    End Sub
    Private Sub Schedule1_BeforeDelete(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeDeleteEvent) Handles Schedule1.BeforeDelete
        Call frmMDI.DefInstance.DisplayMessage("BeforeDelete", True)
    End Sub
    Private Sub Schedule1_BeforeEdit(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeEditEvent) Handles Schedule1.BeforeEdit

        'If you want a custom Edit dialogbox
        'Then set "Cancel" to false and put up your own dialogbox

        Call frmMDI.DefInstance.DisplayMessage("BeforeEdit", True)

        If UseCustomDialog Then
            'Set cancel to true so the the Schedule control
            'does not try to edit the appointment
            eventArgs.cancel = True

            Dim frmProperties As New frmProperties()
            frmProperties.DefInstance.ParentForm_Renamed = Me
            Call frmProperties.DefInstance.RefreshForm(Schedule1.ViewMode, Schedule1.TimeFormat, Schedule1.AllowEventHeader, False, True, Schedule1.ScheduleItems.Item(eventArgs.index), Schedule1.Categories, Schedule1.Rooms, Schedule1.Providers)
            frmProperties.DefInstance.ShowDialog()
            Call Schedule1.CtlRefresh()

            '    'Put your custom dialog here you can access and set the added
            '    'ScheduleItem by using the "Index" parameter that came into this
            '    'event. The Index is a pointer in the ScheduelItems collection
            '    Call MsgBox("ADD YOUR OWN DIALOGBOX HERE!" & vbCrLf & vbCrLf & _
            ''        "Appointment Properties" & vbCrLf & _
            ''        "StartTime: " & CStr(Schedule1.ScheduleItems(Index).StartTime) & vbCrLf & _
            ''        "Length: " & CStr(Schedule1.ScheduleItems(Index).Length), vbInformation)

        End If

    End Sub
    Private Sub Schedule1_BeforeItemResize(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeItemResizeEvent) Handles Schedule1.BeforeItemResize
        Call frmMDI.DefInstance.DisplayMessage("BeforeItemResize", True)
    End Sub
    Private Sub Schedule1_BeforeMove(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_BeforeMoveEvent) Handles Schedule1.BeforeMove
        Call frmMDI.DefInstance.DisplayMessage("BeforeMove", True)
    End Sub
    Private Sub Schedule1_CategoryClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_CategoryClickEvent) Handles Schedule1.CategoryClick
        Call frmMDI.DefInstance.DisplayMessage("CategoryClick: " & eventArgs.oCategory.Name, True)
    End Sub
    Private Sub Schedule1_CategoryHeaderClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_CategoryHeaderClickEvent) Handles Schedule1.CategoryHeaderClick
        Call frmMDI.DefInstance.DisplayMessage("CategoryHeaderClick", True)
    End Sub
    Private Sub Schedule1_DayHeaderClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_DayHeaderClickEvent) Handles Schedule1.DayHeaderClick
        Call frmMDI.DefInstance.DisplayMessage("DayHeaderClick:Date=" & eventArgs.dtDate, True)
    End Sub
    Private Sub Schedule1_DragOverSchedule(ByVal ApptDate As Date, ByVal ApptRoom As Integer, ByVal ApptTime As Date, ByVal ApptLength As Integer, ByVal DragOperation As Scheduler.DragOperationConstants, ByRef Effect As Integer)
        Call frmMDI.DefInstance.DisplayMessage("DragOverSchedule:Date=" & VB6.Format(ApptDate, "short date") & "  Room=" & ApptRoom & "  Time=" & VB6.Format(ApptTime, "short time"), True)
    End Sub
    Private Sub Schedule1_MouseUpEvent(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_MouseUpEvent) Handles Schedule1.MouseUpEvent

        If eventArgs.button = VB6.MouseButtonConstants.RightButton Then
            'UPGRADE_ISSUE: Form method frmChild.PopupMenu was not upgraded. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2064"'
            'PopupMenu(frmMDI.DefInstance.mnuSchedule)
        End If

    End Sub
    Private Sub Schedule1_PrintDone(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Schedule1.PrintDone
        Call frmMDI.DefInstance.DisplayMessage("PrintDone", True)
    End Sub
    Private Sub Schedule1_PrintProgess(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_PrintProgessEvent) Handles Schedule1.PrintProgess
        Call frmMDI.DefInstance.DisplayMessage("PrintProgess:" & eventArgs.percent & "%", True)
    End Sub
    Private Sub Schedule1_RoomHeaderClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_RoomHeaderClickEvent) Handles Schedule1.RoomHeaderClick
        Call frmMDI.DefInstance.DisplayMessage("RoomHeaderClick:RoomName=" & eventArgs.roomName, True)
    End Sub
    Private Sub Schedule1_ScheduleItemClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_ScheduleItemClickEvent) Handles Schedule1.ScheduleItemClick
        Call frmMDI.DefInstance.DisplayMessage("ScheduleItemClick: " & eventArgs.itemIndex, True)
    End Sub
    Private Sub Schedule1_TimeMarginClick(ByVal eventSender As System.Object, ByVal eventArgs As AxScheduler.__Schedule_TimeMarginClickEvent) Handles Schedule1.TimeMarginClick
        Call frmMDI.DefInstance.DisplayMessage("TimeMarginClick", True)
    End Sub
End Class